<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">加班人名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" value="{$user_name ?? ''}" placeholder="请输入加班人名称" autocomplete="off"
                   class="layui-input" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属部门</label>
        <div class="layui-input-block">
            <input type="text" name="group_name" lay-verify="required" value="{$group_name ?? ''}" placeholder="请输入所属部门"
                   autocomplete="off"
                   class="layui-input" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开始时间</label>
        <div class="layui-input-block">
            <input type="text" name="start_time" id="start_time" value="{$model.start_time ?? ''}" lay-verify="required" placeholder="请输入开始时间" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">结束时间</label>
        <div class="layui-input-block">
            <input type="text" name="end_time" id="end_time" value="{$model.end_time ?? ''}" lay-verify="required" placeholder="请输入结束时间" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">加班事由</label>
        <div class="layui-input-block">
            <textarea class="layui-textarea" name="content">{$model.content ?? ''}</textarea>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>

<script src="/static/admin/layui/layui.js"></script>

<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        treeTable: '../admin/lib/extend/authtree'
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$, form = layui.form, laydate = layui.laydate;

        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        if (month < 10 && month > 0) {
            month = '0' + month;
        }
        var day = date.getDate();
        if (day < 10 && day > 0) {
            day = '0' + day;
        }
        var now = new Date();
        var sjz = new Date(year + '-' + month + '-' + day + ' ' + '18:00');
        //日期范围
        laydate.render({
            elem: '#start_time'
            , type: 'datetime'
            , trigger: 'click'//呼出事件改成click
            , format: "yyyy-MM-dd HH:mm"
            , value: sjz
            ,btns: ['clear', 'confirm']
            , change: function (value, date, endDate) {
                var dateortime = $(".layui-laydate").find(".layui-laydate-footer").find("span").text().substr(0, 4);
                if (dateortime == "返回日期") {
                    var aa = $(".laydate-time-list li ol")[1];
                    var showtime = $($(".laydate-time-list li ol")[1]).find("li");
                    for (var i = 0; i < showtime.length; i++) {
                        var t00 = showtime[i].innerText;
                        if (t00 != "00" && t00 != "30") {
                            showtime[i].remove()
                        }
                    }
                    $($(".laydate-time-list li ol")[2]).find("li").remove();  //清空秒
                }
            }
        });
        //日期范围
        laydate.render({
            elem: '#end_time'
            , type: 'datetime'
            , trigger: 'click'
            , format: "yyyy-MM-dd HH:mm"
            ,btns: ['clear', 'confirm']
            , ready: function (date) {
                //可以自定义时分秒
                this.dateTime.hours = now.getHours();
                this.dateTime.minutes = now.getMinutes();
            }
            , change: function (value, date, endDate) {
                var dateortime = $(".layui-laydate").find(".layui-laydate-footer").find("span").text().substr(0, 4);
                if (dateortime == "返回日期") {
                    var aa = $(".laydate-time-list li ol")[1];
                    var showtime = $($(".laydate-time-list li ol")[1]).find("li");
                    for (var i = 0; i < showtime.length; i++) {
                        var t00 = showtime[i].innerText;
                        if (t00 != "00" && t00 != "30") {
                            showtime[i].remove()
                        }
                    }
                    $($(".laydate-time-list li ol")[2]).find("li").remove();  //清空秒
                }
            }

        });
    });


</script>
